package com.neusoft.neuiotms.dcam.fixed.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.neuiotms.dcam.common.model.Location;
import com.neusoft.neuiotms.dcam.fixed.model.enums.StorehouseStatus;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 库房
 *
 * @author wys
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_fixed_storehouse")
@org.hibernate.annotations.Table(appliesTo = "neuiot_fixed_storehouse", comment = "库房表")
public class Storehouse extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    /** 库房名 */
    @NotBlank(message = "库房名不能为空")
    @Length(max = 100, message = "库房名不能超过{max}位")
    @Column(length = 100, nullable = false, unique = true)
    private String name;

    /** 状态 */
    @Enumerated(EnumType.STRING)
    @NotNull(message = "状态不能为空")
    private StorehouseStatus status = StorehouseStatus.created;

    /** 位置 */
    @ManyToOne
    private Location location;

}
